package com.hjsmallfly.syllabus.room.record;

import android.os.Parcel;
import android.os.Parcelable;
import com.hjsmallfly.syllabus.bean.Semester;
import com.hjsmallfly.syllabus.bean.SemesterData;

import java.util.ArrayList;
import java.util.List;

public class MockLesson implements Parcelable {

    private List<Long> lessons;
    private SemesterData semester;

    public List<Long> getLessons() {
        if (lessons == null) {
            lessons = new ArrayList<>();
        }
        return lessons;
    }

    public void setLessons(List<Long> lessons) {
        this.lessons = lessons;
    }

    public SemesterData getSemester() {
        return semester;
    }

    public void setSemester(SemesterData semester) {
        this.semester = semester;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.lessons);
        dest.writeParcelable(this.semester, flags);
    }

    public MockLesson() {
    }

    protected MockLesson(Parcel in) {
        this.lessons = new ArrayList<Long>();
        in.readList(this.lessons, Long.class.getClassLoader());
        this.semester = in.readParcelable(Semester.class.getClassLoader());
    }

    public static final Parcelable.Creator<MockLesson> CREATOR = new Parcelable.Creator<MockLesson>() {
        @Override
        public MockLesson createFromParcel(Parcel source) {
            return new MockLesson(source);
        }

        @Override
        public MockLesson[] newArray(int size) {
            return new MockLesson[size];
        }
    };
}
